package xin.zhiyin.控制.front;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import xin.zhiyin.实体.书类目Entity;
import xin.zhiyin.服务.书.书Service;
import xin.zhiyin.服务.书.书类目Service;

import java.util.List;

@Controller
@RequestMapping(path = "/books")
public class 列表页Controller {
    @Autowired
    private xin.zhiyin.服务.书.书类目Service 书类目Service;
    @Autowired
    private xin.zhiyin.服务.书.书Service 书Service;
    @GetMapping(path = "")
    public String 取首页(Long categoryId,Model model)
    {
        书类目Entity 类目 = 书类目Service.根据Id获取书类目(categoryId);
        model.addAttribute("category",类目);
        model.addAttribute("bookList",书Service.根据categoryId获取书(categoryId));
        return "front/list/books";//
    }
}
